package chapter1.No1_7_停止线程.f释放锁的不良后果;

/**
 * !
 *
 * @author liujian
 * @version 2016/11/9 0009
 */
public class SynchronizedObject {
    private String userName = "a";
    private String psw = "aa";

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPsw() {
        return psw;
    }

    public void setPsw(String psw) {
        this.psw = psw;
    }

    public synchronized void doLogin(String userName, String psw){
        try {
            this.userName=userName;
            Thread.sleep(5000);
            this.psw = psw;
            System.out.println("登录业务处理");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
